//
//  XMGXMGRecomendCell.m
//  01 baisi
//
//  Created by 檀志文 on 16/4/9.
//  Copyright © 2016年 ios檀志文. All rights reserved.
//

#import "XMGXMGRecomendCell.h"
#import "XMGRecomendCategories.h"

@interface XMGXMGRecomendCell()

@property (weak, nonatomic) IBOutlet UIView *selectedIndicator;


@end

@implementation XMGXMGRecomendCell

- (void)awakeFromNib {
    self.backgroundColor = XMGRGBColor(244, 244, 244);

    self.selectedIndicator.backgroundColor = XMGRGBColor(219, 21, 26);

}

- (void)setCategory:(XMGRecomendCategories *)category{
    _category =category;
    self.textLabel.text =category.name;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.textLabel.y = 2;
    self.textLabel.height = self.contentView.height -2 *self.textLabel.y;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    
    [super setSelected:selected animated:YES];
    self.selectedIndicator.hidden = !selected;

    self.textLabel.textColor = selected?self.selectedIndicator.backgroundColor:XMGRGBColor(78, 78, 78);
}


@end
